# Contributor: omni <omni+alpine@hack.org>
# Maintainer: omni <omni+alpine@hack.org>
pkgname=rtl_433
pkgver=23.11
pkgrel=0
pkgdesc="Program to decode transmissions on the ISM bands"
url="https://github.com/merbanan/rtl_433"
arch="all"
license="GPL-2.0-or-later"
makedepends="
	cmake
	librtlsdr-dev
	libusb-dev
	openssl-dev>3
	samurai
	"
subpackages="$pkgname-doc $pkgname-dev"
source="$pkgname-$pkgver.tar.gz::https://github.com/merbanan/rtl_433/archive/refs/tags/$pkgver.tar.gz
	sysconfdir.patch
	"

# secfixes:
#   21.12-r3:
#     - CVE-2022-25050
#     - CVE-2022-25051
#     - CVE-2022-27419

build() {
	cmake -B build -G Ninja \
		-DCMAKE_BUILD_TYPE=MinSizeRel \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_SYSCONFDIR=/etc
	cmake --build build
}

check() {
	ctest --test-dir build --output-on-failure
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

sha512sums="
a34822c8b20d58c81b331b3eec084dcaeb515f25461f12dc03168743ec6fe4afa0fc5dd60f25937a896772ce3c29e61d598e70e349de056ef9bc99de6c500ee4  rtl_433-23.11.tar.gz
bbc81c7b0a7c6a1462b3434ca7e6f40814decbbe6de103662b6814e716e587367d838fa6ba0880d4b2609ea7f050aac02a197c8fdf6804b9235eb2e00fac079e  sysconfdir.patch
"
